package com.pz.cloud.framework.base.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.pz.cloud.framework.base.service.TableInterface;
import com.pz.cloud.framework.business.workflow.model.ProcessRecordModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * 基础类 所有的实体类必须继承这个类
 * @author 3hmzz
 *
 */
@Data
public class BaseEntity extends Pageable implements TableInterface {

    /**删除状态（0，正常，1已删除）*/
    @Dict(dicCode = "del_flag")
    @TableLogic
    @ApiModelProperty(hidden = true)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Integer delFlag;

    /**创建人*/
    private String creatorId;

    /**创建人*/
    private String creatorName;

    /**创建日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**更新日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(hidden = true)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Date updateTime;

    @Transient
    @JsonIgnore
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Integer exportIndex;//导出序号

    @TableField(exist = false)
    private List<ProcessRecordModel> approveRecords;

}
